<%if(session.getAttribute("uname")==null)
{
	response.sendRedirect("index.jsp?msg=You need to log in first");
}
%>
<%@page import="java.sql.*" %>
<%@ page import="com.hline.kbcss.MyDriver"%>
<%String username1=(String)session.getAttribute("uname");
  String password1=(String)session.getAttribute("pswd");
  String currentpassword=request.getParameter("opswd");
  System.out.println("user name is"+username1);
   System.out.println("password is"+password1);
    System.out.println("cp is"+currentpassword);
  if(password1.equals(currentpassword))
  {
	  String newpassword=request.getParameter("opswd2");
	try
	{
		Statement stmt=MyDriver.getConnection("READ");
		String str="update faculty set pswd='"+newpassword+"' where uname='"+username1+"'";
		int i=stmt.executeUpdate(str);
		response.sendRedirect("innerpage.jsp?message=<p><font color=red>your password changed successfully</font></p>");
	}catch(Exception e){
		System.out.println(e);
	}
  }else{
	  response.sendRedirect("cp.jsp?message=<p><font color=red>your current password is not matched</font></p>");
  }


%>